<!DOCTYPE html>
<!--
Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="/tracing/core/scripting_controller.html">
<link rel="import" href="/tracing/extras/tquery/filter.html">

<script>
'use strict';

tr.exportTo('tr.e.tquery', function() {
  function FilterHasTitle(expected) {
    tr.e.tquery.Filter.call(this);
    this.expected = expected;
  }

  FilterHasTitle.prototype = {
    __proto__: tr.e.tquery.Filter.prototype,

    evaluate(context) {
      return this.matchValue_(context.event.title, this.expected);
    }
  };
  tr.c.ScriptingObjectRegistry.register(
      function(expected) {
        const filter = new tr.e.tquery.FilterHasTitle(expected);
        return filter;
      },
      {
        name: 'hasTitle'
      }
  );

  return {
    FilterHasTitle,
  };
});
</script>
